<?php

// application/models/Tblcontact.php
class Application_Model_Tblcontact {

    protected $_id;
    protected $_company_id;
    protected $_contact_type;
    protected $_contact_ref;
    protected $_last_updated_on;

    public function __construct(array $options = null) {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value) {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('public function __set : Invalid tblcontact property');
        }
        $this->$method($value);
    }

    public function __get($name) {
        $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('public function __get : Invalid tblcontact property');
        }
        return $this->$method();
    }

    public function setOptions(array $options) {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }

    public function setId($id) {
        $this->_id = (int) $id;
        return $this;
    }

    public function getId() {
        return $this->_id;
    }

    public function setCompany_id($text) {
        $this->_company_id = (string) $text;
        return $this;
    }

    public function getCompany_id() {
        return $this->_company_id;
    }

    public function setContact_type($text) {
        $this->_contact_type = (string) $text;
        return $this;
    }

    public function getContact_type() {
        return $this->_contact_type;
    }

    public function setContact_ref($text) {
        $this->_contact_ref = (string) $text;
        return $this;
    }

    public function getContact_ref() {
        return $this->_contact_ref;
    }

    public function setLast_updated_on($text) {
        $this->_last_updated_on = (string) $text;
        return $this;
    }

    public function getLast_updated_on() {
        return $this->_last_updated_on;
    }

}
